/* eslint-disable react-hooks/exhaustive-deps */
import { View } from "@tarojs/components";
import { Tabs } from "@taroify/core";
import { useRouter } from "@tarojs/taro";
import { useEffect, useState } from "react";
import DraftBoxPageList from "./components/DraftBoxPageList";
import SubmitedPageList from "./components/SubmitedPageList";

const MonthReport: React.FC = () => {
  const router = useRouter();

  const [value, setValue] = useState(0);

  useEffect(() => {
    if (router?.params?.showTabType) {
      setValue(~~router?.params?.showTabType);
    }
  }, [router]);

  return (
    <View className="">
      <Tabs value={value} onChange={setValue}>
        <Tabs.TabPane key="draftBox" title="草稿箱">
          <DraftBoxPageList />
        </Tabs.TabPane>
        <Tabs.TabPane key="submited" title="已提交">
          <SubmitedPageList />
        </Tabs.TabPane>
      </Tabs>
    </View>
  );
};

export default MonthReport;
